home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Telephone Manager / Stiletto Sources / Sources / CHRSModulesGlue.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-05  |  3.7 KB  |  142 lines  |  [TEXT/MPS ]

  1. /************************************************************************************************/
  2. /*                                                                                                */
  3. /*    Program Name:    Stiletto                                                                    */
  4. /*                                                                                                */
  5. /*    File Name:        CHRSModulesGlue.c                                                            */
  6. /*                                                                                                */
  7. /*    © Apple Computer, Inc. 1991-1995                                                            */
  8. /*    All Rights Reserved                                                                            */
  9. /*                                                                                                */
  10. /*    Revision History:                                                                            */
  11. /*                                                                                                */
  12. /*        Date        Who                    Modification                                            */
  13. /*                                                                                                */
  14. /*        1991-09-28    Chris Halim            Original version                                        */
  15. /*        1995-06-26    Jaakko Railo        Version 2.0                                                */
  16. /*                                                                                                */
  17. /************************************************************************************************/
  18.  
  19. /****************************************** DESCRIPTION ******************************************
  20.  
  21. *************************************************************************************************/
  22.  
  23. /******************************************** HEADERS *******************************************/
  24.  
  25. #ifndef __STDARG__
  26. #include "stdarg.h"
  27. #endif
  28.  
  29. #ifndef __TELEPHONES__
  30. #include "Telephones.h"
  31. #endif
  32.  
  33. #ifndef    __CHRSMODULES__
  34. #include "CHRSModules.h"
  35. #endif
  36.  
  37. /****************************************** DEFINITIONS *****************************************/
  38.  
  39. /****************************************** PROTOTYPES ******************************************/
  40.  
  41. /******************************************** GLOBALS *******************************************/
  42.  
  43. /************************************************************************************************/
  44. /************************************************************************************************/
  45.  
  46.  
  47. pascal TELHandle    GetCurrentTELHandle (CHRSPtr paramPtr)
  48. {
  49.     paramPtr->request = getCurrentTELHandleRequest;
  50.     
  51.     CallEntryPointProc ((EntryPointProcPtr) paramPtr->entryPoint, paramPtr);
  52.  
  53.     return ((TELHandle) paramPtr->outArgs[0]);
  54. }
  55.  
  56.  
  57. pascal TELCAHandle    GetCAHandle (CHRSPtr paramPtr)
  58. {
  59.     paramPtr->request = getCAHandleRequest;
  60.     
  61.     CallEntryPointProc ((EntryPointProcPtr) paramPtr->entryPoint, paramPtr);
  62.     
  63.     return ((TELCAHandle) paramPtr->outArgs[0]);
  64. }
  65.  
  66.  
  67. pascal TELDNHandle    GetDNHandle (CHRSPtr paramPtr)
  68. {
  69.     paramPtr->request = getDNHandleRequest;
  70.     
  71.     CallEntryPointProc ((EntryPointProcPtr) paramPtr->entryPoint, paramPtr);
  72.     
  73.     return ((TELDNHandle) paramPtr->outArgs[0]);
  74. }
  75.  
  76.  
  77. void Print (CHRSPtr paramPtr, const char * format, ...)
  78. {
  79.     va_list        ap;
  80.     
  81.     va_start (ap, format);
  82.     paramPtr->request = printRequest;
  83.     paramPtr->inArgs[0] = (long) format;
  84.     paramPtr->inArgs[1] = (long) ap;
  85.     
  86.     CallEntryPointProc ((EntryPointProcPtr) paramPtr->entryPoint, paramPtr);
  87.  
  88.     va_end (ap);
  89. }
  90.  
  91.  
  92. void     BlinkItem (DialogPtr    theDialog, short itemNumber)
  93. {
  94.     short    itemKind;
  95.     Handle    itemHand;
  96.     Rect    itemRect;
  97.     long    finalTicks;
  98.     
  99.     GetDItem (theDialog, itemNumber, &itemKind, &itemHand, &itemRect);
  100.     
  101.     HiliteControl ((ControlHandle) itemHand, 1);
  102.     Delay (8, &finalTicks);
  103.     HiliteControl ((ControlHandle) itemHand, 0);
  104. }
  105.  
  106.  
  107. pascal Boolean StandardFilterProc(DialogPtr theDialog, EventRecord * theEvent, short * itemHit)
  108. {
  109.     Boolean                wasHandled = false;
  110.     char                key;
  111.             
  112.     switch (theEvent->what) {
  113.         case keyDown :
  114.             key = theEvent->message & charCodeMask;
  115.             
  116.             switch (key) {
  117.                 case '.' :
  118.                     if (theEvent->modifiers & cmdKey) {
  119.                         *itemHit = cancel;
  120.                         BlinkItem (theDialog, *itemHit);
  121.                         wasHandled = true;
  122.                     }
  123.                     break;
  124.                     
  125.                 case 0x1B :                                    // Esc
  126.                     *itemHit = cancel;
  127.                     BlinkItem (theDialog, *itemHit);
  128.                     wasHandled = true;
  129.                     break;
  130.                     
  131.                 case 0x0D :                                    // CR
  132.                 case 0x03 :                                    // Enter
  133.                     *itemHit = ok;
  134.                     BlinkItem (theDialog, *itemHit);
  135.                     wasHandled = true;
  136.                     break;
  137.             }
  138.     }
  139.  
  140.     return (wasHandled);
  141. }
  142.